function PlayerModelMenu( data )

	local selected_model = "male1"

	////OKNO
	local frame = vgui.Create("DFrame")	
	frame:Center()
	frame:SetSize(650,455)
	frame:SetTitle("Select a player model")
	frame:SetBackgroundBlur(true)
	frame:MakePopup()
	
	/////GUMB
	local ok_button = vgui.Create('DButton')
	ok_button:SetParent( frame )
	ok_button:SetSize(70,30)
	ok_button:SetPos(420,380)
	ok_button:SetText( "OK" )
	ok_button:SetVisible( true )
	ok_button.DoClick = function()
		LocalPlayer():Ch_SetModel(selected_model)
		frame:Close()
	end

	////VELIKA IKONA
	
	local lookAtVector = Vector(0,0,40)
	
	local LargeIcon = vgui.Create( "DModelPanel_Dynamic", frame )
	LargeIcon:SetPos(355, 35)
	LargeIcon:SetModel(player_manager.TranslatePlayerModel(selected_model))
	LargeIcon:SetSize(200,200)
	LargeIcon:SetLookAt(lookAtVector)

	////VSE MALE IKONE
    local models = {}

    models[1]  = "female1"
	models[2]  = "female2"
	models[3]  = "female3"
	models[4]  = "female4"
	models[5]  = "female5"
	models[6]  = "female6"
	models[7]  = "male1"
	models[8]  = "male2"
	models[9]  = "male3"
	models[10] = "male4"
	models[11] = "male5"
	models[12] = "male6"
	models[13] = "male7"
	models[14] = "male8"
	models[15] = "male9"
 
	local IconList = vgui.Create( "DPanelList", frame )

	IconList:EnableVerticalScrollbar( true ) 
 	IconList:EnableHorizontal( true ) 
 	IconList:SetPadding( 4 ) 
	IconList:SetPos(10,30)
	IconList:SetSize(300, 415)	
 
	for k,v in pairs(models) do
	local icon = vgui.Create( "SpawnIcon", IconList ) 
	icon:SetModel( player_manager.TranslatePlayerModel(v) )
 	IconList:AddItem( icon )
	icon.DoClick = function( icon ) 
		surface.PlaySound( "ui/buttonclickrelease.wav" ) 
		selected_model = v 
		LargeIcon:SetModel(player_manager.TranslatePlayerModel(selected_model))
		end 
	end
	
	////GUMBI PRI VELIKI IKONI
	DSysRotateRight = vgui.Create('DSysButton')
	DSysRotateRight:SetParent(frame)
	DSysRotateRight:SetSize(40, 20)
	DSysRotateRight:SetPos(485, 320)
	DSysRotateRight:SetType('right')
	DSysRotateRight.DoClick = function()
	lookAtVector = lookAtVector + Vector(0,5,0)
	LargeIcon:SetLookAt(lookAtVector)
	end
	
	DSysRotateUp = vgui.Create('DSysButton')
	DSysRotateUp:SetParent(frame)
	DSysRotateUp:SetSize(40, 20)
	DSysRotateUp:SetPos(435, 290)
	DSysRotateUp:SetType('up')
	DSysRotateUp.DoClick = function()
	lookAtVector = lookAtVector + Vector(0,0,5)
	LargeIcon:SetLookAt(lookAtVector)
	end

	DSysRotateDown = vgui.Create('DSysButton')
	DSysRotateDown:SetParent(frame)
	DSysRotateDown:SetSize(40, 20)
	DSysRotateDown:SetPos(435, 350)
	DSysRotateDown:SetType('down')
	DSysRotateDown.DoClick = function()
	lookAtVector = lookAtVector - Vector(0,0,5)
	LargeIcon:SetLookAt(lookAtVector)
	end

	DSysRotateLeft = vgui.Create('DSysButton')
	DSysRotateLeft:SetParent(frame)
	DSysRotateLeft:SetSize(40, 20)
	DSysRotateLeft:SetPos(385, 320)
	DSysRotateLeft:SetType('left')
	DSysRotateLeft.DoClick = function()
	lookAtVector = lookAtVector - Vector(0,5,0)
	LargeIcon:SetLookAt(lookAtVector)
	end
	
	DButtonZoomOut = vgui.Create('DButton')
	DButtonZoomOut:SetParent(frame)
	DButtonZoomOut:SetSize(50, 11)
	DButtonZoomOut:SetPos(430, 329)
	DButtonZoomOut:SetText('-')
	DButtonZoomOut.DoClick = function()
	LargeIcon:SetFOV(LargeIcon:GetFOV() + 5)
	end
	
	DButtonZoomIn = vgui.Create('DButton')
	DButtonZoomIn:SetParent(frame)
	DButtonZoomIn:SetSize(50, 11)
	DButtonZoomIn:SetPos(430, 320)
	DButtonZoomIn:SetText('+')
	DButtonZoomIn.DoClick = function()
	LargeIcon:SetFOV(LargeIcon:GetFOV() - 5)
	end
	
	DButtonAnim_none = vgui.Create('DButton')
	DButtonAnim_none:SetParent(frame)
	DButtonAnim_none:SetSize(50, 25)
	DButtonAnim_none:SetPos(555, 150)
	DButtonAnim_none:SetText('STAND')
	DButtonAnim_none.DoClick = function()
	LargeIcon:SetAnimated(false)
	end

	DButtonAnim_Walk = vgui.Create('DButton')
	DButtonAnim_Walk:SetParent(frame)
	DButtonAnim_Walk:SetSize(50, 25)
	DButtonAnim_Walk:SetPos(555, 100)
	DButtonAnim_Walk:SetText('WALK')
	DButtonAnim_Walk.DoClick = function()
	LargeIcon:SetModelAnimation("walk_all")
	LargeIcon:SetAnimated(true)
	end
	
	DButtonAnim_crouch_walk = vgui.Create('DButton')
	DButtonAnim_crouch_walk:SetParent(frame)
	DButtonAnim_crouch_walk:SetSize(90, 25)
	DButtonAnim_crouch_walk:SetPos(555, 125)
	DButtonAnim_crouch_walk:SetText('CROUCH WALK')
	DButtonAnim_crouch_walk.DoClick = function() 
	LargeIcon:SetModelAnimation("Crouch_walk_all")
	LargeIcon:SetAnimated(true)
	end
	
	////Nastavitve pri veliki ikoni
	
	local DNumSlider1 = vgui.Create('DNumSlider', frame)
	DNumSlider1:SetWide(118)
	DNumSlider1:SetParent(frame)
	DNumSlider1:SetPos(395, 245)
	DNumSlider1:SetDecimals(0)
	//DNumSlider1:SetFloatValue(0)
	//DNumSlider1:SetFraction(0)
	DNumSlider1.OnValueChanged = function( panel, value ) 
	LargeIcon:SetModelAngle(value)
	end
	DNumSlider1:SetText('Angle')
	DNumSlider1:SetValue(0)
	DNumSlider1:SetMinMax( 0, 360)

	DCheckBox_rotation = vgui.Create('DCheckBoxLabel')
	DCheckBox_rotation:SetValue(1)
	DCheckBox_rotation:SetParent(frame)
	DCheckBox_rotation:SetPos(510, 295)
	DCheckBox_rotation:SetText('Rotate')
	DCheckBox_rotation.OnChange = function()
	LargeIcon:SetModelRotation(DCheckBox_rotation:GetChecked())
	end
	
end

usermessage.Hook( "OPEN_CHARACTER_MENU", PlayerModelMenu )